﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace clockerEditor
{
    public class UtilityBelt
    {
        //declare textures


        
         Texture2D panel;
         Texture2D newMap;
         Texture2D saveMap;
         Texture2D loadMap;
         Texture2D loadTiles;
         Texture2D backLayer;
         Texture2D frontLayer;
         Texture2D collisionLayer;

         Vector2 position; // position of the utility belt... no not all utility belts go on your waist

        // put all the buttons in a list so that they can be used together
         List<Buttons> buttons = new List<Buttons>();

         public UtilityBelt(ContentManager content)
         {
             panel = content.Load<Texture2D>(@"PlaceSpritesHere/panel");
             newMap = content.Load<Texture2D>(@"PlaceSpritesHere/newMapButton");
             saveMap = content.Load<Texture2D>(@"PlaceSpritesHere/saveMapButton");
             loadMap = content.Load<Texture2D>(@"PlaceSpritesHere/loadMapButton");
             loadTiles = content.Load<Texture2D>(@"PlaceSpritesHere/loadTileButton");
             backLayer = content.Load<Texture2D>(@"PlaceSpritesHere/backLayer");
             frontLayer = content.Load<Texture2D>(@"PlaceSpritesHere/frontLayer");
             collisionLayer = content.Load<Texture2D>(@"PlaceSpritesHere/collisionLayerButton");
              

             //position

             position = new Vector2(0, (int)Game1.windowSize.Y - panel.Height);

             // putting items in the utility belt

             buttons.Add(new NewMap(newMap, new Vector2(position.X + 25, position.Y + 25)));
             buttons.Add(new SaveMap(saveMap, new Vector2(position.X + 25, position.Y + 25)));
             buttons.Add(new LoadMap(loadMap, new Vector2(position.X + 25, position.Y + 25)));
             buttons.Add(new LoadTile(loadTiles, new Vector2(position.X + 25, position.Y + 25)));
             buttons.Add(new BackLayer(backLayer, new Vector2(position.X + 25, position.Y + 25)));
             buttons.Add(new FrontLayer(frontLayer, new Vector2(position.X + 25, position.Y + 25)));
             buttons.Add(new Collision(collisionLayer, new Vector2(position.X + 25, position.Y + 25)));


         }

         public void update()
         {
             //loop through button list.... yay

             for (int i = 0; i < buttons.Count; i++)
             {
                 buttons[i].update();

                 if (buttons[i].clicked)
                     buttons[i].effect();


             }
         }

         public void draw()
         {
             Game1.spriteBatch.Draw(panel, position, Color.White);

             for (int i = 0; i < buttons.Count; i++)
             {
                 buttons[i].draw();
             }


         }




    }
}
